<tr>
    <th>活动类型</th>
    <td>
    	<div class="radio">
        <script>
		if('{$parameter_default[hdtype]}' == 1){
			document.write('<label style="margin:0; font-weight:normal;" name="hdtype1"><input id="hdtype1" name="parameter_default[hdtype]" type="radio" value="0" onclick="typedata(this.value)" />所有商品</label> <label style="margin:0; font-weight:normal;" name="hdtype2"><input id="hdtype2" name="parameter_default[hdtype]" type="radio" value="1" onclick="typedata(this.value)" checked="checked" />指定商品</label>');
		}else{
			document.write('<label style="margin:0; font-weight:normal;" name="hdtype1"><input id="hdtype1" name="parameter_default[hdtype]" type="radio" value="0" onclick="typedata(this.value)" checked="checked" />所有商品</label> <label style="margin:0; font-weight:normal;" name="hdtype2"><input id="hdtype2" name="parameter_default[hdtype]" type="radio" value="1" onclick="typedata(this.value)" />指定商品</label>');
		}
		</script>
        </div>
    </td>
</tr>
<tr id="goodssearch" style="display:none;">
    <th>查找商品</th>
    <td>
        <style>
			.searchgoods-ncap-btn{ color:#777;background-color:#F5F5F5;text-align:center;vertical-align:middle;display:inline-block;height:32px;padding:5px 25px;border:solid 1px;border-color:#DCDCDC #DCDCDC #B3B3B3 #DCDCDC;border-radius:3px;cursor:pointer}
			.searchgoods-ncap-btn:hover{text-decoration:none;color:#333;background-color:#E6E6E6;border-color:#CFCFCF #CFCFCF #B3B3B3 #CFCFCF}
			.searchgoods-ncap-btn i {
				font-size: 14px;
				vertical-align: baseline;
				margin-right: 4px;
			}
			.searchgoods .ys-btn-close {
				position: relative;
				top: -12px;
				left: -16px;
				width: 18px;
				height: 18px;
				border: 1px solid #ccc;
				line-height: 15px;
				text-align: center;
				display: inline-block;
				border-radius: 50%;
				z-index: 1;
				background-color: #fff;
				cursor: pointer;
			}
			.searchgoods .selected-group-goods {
				background-color: #FFF;
				width: 182px;
				padding: 9px;
				margin-bottom: 10px;
				border: solid 1px #E6E6E6;
				box-shadow: 2px 2px 0 rgba(153,153,153,0.1);
			}
			.searchgoods .selected-group-goods .goods-name {
				height: 48px;
				overflow: hidden;
				text-overflow: ellipsis;
				display: -webkit-box;
				-webkit-line-clamp: 2;
				overflow:hidden;
				-webkit-box-orient: vertical;
				margin-top:5px;
			}
		
		</style>
        <a href="javascript:openPageLayer(['70%', '80%'],'查找活动商品','hdgoodslist');" class="searchgoods-ncap-btn"><i class="fa fa-search"></i>选择商品</a>
        <div id="hdgoodslist" style="display:none; padding:20px;">
            <div class="searchgoodslist">
                <input type="text" class="form-control" style="width:90%; float:left; margin-right:5px;" id="keyword" value="" placeholder="请输入搜索关键词"/> <input type="button" class="btn" value="搜索" onclick="getPage()" />
                <div style="clear:both;"></div>
                <div id="orders" style="margin-top:20px;"></div>
                <input  class="btn btn-default" type="button" value="确定提交" onclick="getsarchgoods()" style="margin:0">
                <input type="hidden" name="parameter_default[hdgoodsids]" value="{$parameter_default[hdgoodsids]}" id="order_ids" autocomplete="off" class="input"/>
            </div>
        </div>
        <script type="text/javascript">
			function getsarchgoods() {
				var order_ids = $("#order_ids").val();
				// 显示已选商品列表
				if(order_ids) {
					$.post("/portal/admin_ajax/index.html",{ajaxid:3,ajaxname:"searchgoods",searchids:order_ids},function(data){
						var data=eval('('+data+')');
						console.log(data);
						if(data.error == 0){
							var content = data.content;
							$("#selected_group_goods").html(content);
						}	
					});
				}
			}
			getsarchgoods();
		</script>
        <div class="searchgoods" style="overflow: hidden; font-size: 12px; line-height: 24px;" id="selected_group_goods"></div>
    </td>
</tr>
<tr>
    <th>优惠类型</th>
    <td>
    	<div class="radio">
        <script>
		if('{$parameter_default[yhhdtype]}' == 1){
			document.write('<label style="margin:0; font-weight:normal;" name="yhtype1"><input id="yhtype1" name="parameter_default[yhhdtype]" type="radio" value="0" onclick="yhtypedata(this.value)" />满额立减</label> <label style="margin:0; font-weight:normal;" name="yhtype2"><input id="yhtype2" name="parameter_default[yhhdtype]" type="radio" value="1" checked="checked" onclick="yhtypedata(this.value)" />满额打折</label>');
		}else{
			document.write('<label style="margin:0; font-weight:normal;" name="yhtype1"><input id="yhtype1" name="parameter_default[yhhdtype]" type="radio" value="0" checked="checked" onclick="yhtypedata(this.value)" />满额立减</label> <label style="margin:0; font-weight:normal;" name="yhtype2"><input id="yhtype2" name="parameter_default[yhhdtype]" type="radio" value="1" onclick="yhtypedata(this.value)" />满额打折</label>');
		}
		</script>
        </div>
    </td>
</tr>
<tr>
    <th>需要满足的金额</th>
    <td>
        <input class="form-control" type="text" name="parameter_default[tomoney]" value="($parameter_default[tomoney])" required placeholder="请输入需要满足的金额">
        <p class="help-block">单位：元</p>
    </td>
</tr>
<tr id="yhmoney">
    <th>立减金额</th>
    <td>
        <input class="form-control" type="text" name="parameter[yhmoney]" value="($parameter[yhmoney])" placeholder="请输入优惠金额">
        <p class="help-block">立减金额（元）</p>
    </td>
</tr>
<tr id="expression" style="display:none;">
    <th>折扣</th>
    <td>
        <input class="form-control" type="text" name="parameter[expression]" value="($parameter[expression])" placeholder="请输入折扣">
        <p class="help-block">请输入0.1~10之间的数字,值为空代表不设置折扣</p>
    </td>
</tr>
<tr>
    <th>过期时间</th>
    <td>
        <input class="form-control" type="date" name="parameter_default[datetype_endtime]" value="($parameter_default[datetype_endtime])" required placeholder="请输入过期时间">
    </td>
</tr>
<script>
if('{$parameter_default[hdtype]}' == 1){
	$('#goodssearch').show();
}
function typedata(id)
{
	// 验证规则
	if(id == 1){
		$('#goodssearch').show();
	}else{
		$('#goodssearch').hide();
	}
}
if('{$parameter_default[yhhdtype]}' == 1){
	$('#expression').show();
	$('#yhmoney').hide();
}
function yhtypedata(id)
{
	// 验证规则
	if(id == 1){
		$('#expression').show();
		$('#yhmoney').hide();
	}else{
		$('#yhmoney').show();
		$('#expression').hide();
	}
}
</script>